package com.smartstate.dataManagement.service.impl;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.smartstate.dataManagement.dto.PageDTO;
import com.smartstate.dataManagement.entity.CarbonConfig;
import com.smartstate.dataManagement.mapper.CarbonConfigMapper;
import com.smartstate.dataManagement.service.CarbonConfigService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class CarbonConfigImpl extends ServiceImpl<CarbonConfigMapper, CarbonConfig> implements CarbonConfigService {


    @Autowired
    CarbonConfigMapper carbonConfigMapper;

    @Override
    public Page<CarbonConfig> queryAllPageByDTO(PageDTO pageDTO) {
        return null;
    }

    /**
     * 查询当前信息是否唯一
     * @param configItem
     * @return
     */
    @Override
    public Boolean getIdByOne(String configItem) {
        int idByOne = carbonConfigMapper.getIdByOne(configItem);
        if (idByOne >= 1 ){
            return false;
        }
        return true;
    }

    @Override
    public void updateByItem(String configItem, String configDevice) {
       carbonConfigMapper.updateByItem(configItem,configDevice);
    }

    @Override
    public CarbonConfig getByOne(String configItem) {
        return carbonConfigMapper.getByOne(configItem);
    }

}
